﻿using System;

namespace MessagePack.Formatters
{
	// Token: 0x02000059 RID: 89
	public class TimeSpanFormatter : IMessagePackFormatter<TimeSpan>
	{
		// Token: 0x06000153 RID: 339 RVA: 0x00005859 File Offset: 0x00003C59
		private TimeSpanFormatter()
		{
		}

		// Token: 0x06000154 RID: 340 RVA: 0x00005861 File Offset: 0x00003C61
		public int Serialize(ref byte[] bytes, int offset, TimeSpan value, IFormatterResolver formatterResolver)
		{
			return MessagePackBinary.WriteInt64(ref bytes, offset, value.Ticks);
		}

		// Token: 0x06000155 RID: 341 RVA: 0x00005871 File Offset: 0x00003C71
		public TimeSpan Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
		{
			return new TimeSpan(MessagePackBinary.ReadInt64(bytes, offset, out readSize));
		}

		// Token: 0x0400004E RID: 78
		public static readonly IMessagePackFormatter<TimeSpan> Instance = new TimeSpanFormatter();
	}
}
